﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoPartsSearch.Domain.Abstract;
using System.Net.Mail;

namespace AutoPartsSearch.Web.Infrastructure.Concrete
{
    public class SmtpMessageSender : IMessageSender
    {
        public void Send(Domain.Entities.Messages.Message message)
        {
            MailMessage mailMessage = new MailMessage()
            {
                From = new MailAddress(message.From),
                Subject = message.Subject, 
                Body = message.Body
            };
            mailMessage.Bcc.Add(message.To);
            SmtpClient client = new SmtpClient
                                    {
                                        EnableSsl = true
                                    };
            client.Send(mailMessage);
        }
    }
}